package com.huawei.appmarket.service.store.awk.card;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseCardBean;
import com.huawei.appmarket.service.store.awk.bean.NewEntranceCardBean;
import o.cgz;
import o.chy;
import o.chz;
import o.dof;
import o.ebh;
import o.ebi;
import o.ebk;
import o.eib;
import o.epv;
import o.eqx;
import o.evx;
import o.ewm.j;

public class NewEntranceCard extends BaseDistCard {
    private Context ʻ;
    private ebk ʼ;
    protected RelativeLayout ˋ;
    private TextView ॱॱ;
    private String ᐝ = "";

    public NewEntranceCard(Context context) {
        super(context);
        this.ʻ = context;
    }

    public cgz ˏ(View view) {
        ˏ((ImageView) view.findViewById(j.ʻˊ));
        this.ॱॱ = (TextView) view.findViewById(j.ㆍʼ);
        this.ˋ = (RelativeLayout) view.findViewById(j.ⵗॱ);
        ʽ(view);
        return this;
    }

    public void ˎ(BaseCardBean baseCardBean) {
        if (baseCardBean != null && (baseCardBean instanceof NewEntranceCardBean)) {
            ebh o_ebh = (NewEntranceCardBean) baseCardBean;
            ॱ(o_ebh.ˑॱ(), o_ebh.ॱˌ(), o_ebh.v_());
            ˋ(this.ॱॱ, o_ebh.ˋʻ());
            if (this.ʼ != null) {
                this.ʼ.ˋ(o_ebh);
                this.ʼ.ˊ();
            }
        }
    }

    protected void ॱ(String str, String str2, String str3) {
        int i;
        this.ˋˊ = 2.0d;
        this.ˊˊ = 3.75d;
        int ˎ = epv.ˎ(this.ʼॱ, 2, eib.ʼॱ());
        String str4 = "";
        if (epv.ʼ(this.ʻ)) {
            i = (int) (((double) ˎ) / this.ˋˊ);
        } else {
            int i2 = (int) (((double) ˎ) / this.ˊˊ);
            if (dof.ˋ(str)) {
                i = i2;
            } else {
                str2 = str;
                i = i2;
            }
        }
        LayoutParams layoutParams = (LayoutParams) this.ˋ.getLayoutParams();
        layoutParams.width = ˎ;
        layoutParams.height = i;
        this.ʽॱ.setContentDescription(str3);
        this.ˋ.setLayoutParams(layoutParams);
        eqx.ˏ(this.ʽॱ, str2, "image_default_icon");
    }

    public void ॱ(final chy o_chy) {
        ʼॱ().setOnClickListener(new evx(this) {
            final /* synthetic */ NewEntranceCard ॱ;

            public void ˋ(View view) {
                o_chy.ˏ(0, this.ॱ);
                if (this.ॱ.ˌ() instanceof NewEntranceCardBean) {
                    NewEntranceCardBean newEntranceCardBean = (NewEntranceCardBean) this.ॱ.ˌ();
                    if (ebi.ˏ(this.ॱ.ᐝ)) {
                        ebi.ˊ().ॱ((Activity) view.getContext(), newEntranceCardBean);
                    }
                    if (!newEntranceCardBean.ˈ(newEntranceCardBean.ॱॱ())) {
                        newEntranceCardBean.ʾ(newEntranceCardBean.ॱॱ());
                    }
                }
            }
        });
    }

    public void ˋ(ebk o_ebk) {
        this.ʼ = o_ebk;
    }

    public void ॱ(chz o_chz) {
        if (o_chz != null) {
            this.ᐝ = o_chz.ˏॱ();
        }
        super.ॱ(o_chz);
    }
}
